<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <ul>
      <li>郑昊</li>
      <li>李天成</li>
      <li>盘志华</li>
      <li>梁恐爪</li>
      <li>张西文</li>
    </ul>
    <script>
      function flex(dom, target) {
        var speed = 10;
        var a = null,
          timer = null;
        timer = setInterval(() => {
          a = (target - oDiv.offsetLeft) / 7;
          speed += a;
          speed = 0.8 * speed;
          console.log(speed);
          console.log(target - oDiv.offsetLeft);
          console.log('-------------------');
          if (Math.abs(speed) < 1 && Math.abs(target - oDiv.offsetLeft < 1)) {
            oDiv.style.left = target + 'px';
            clearInterval(timer);
          } else {
            oDiv.style.left = oDiv.offsetLeft + speed + 'px';
          }
        }, 30);
      }
    </script>
  </body>
</html>
